package com.zzyl.nursing.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class DeviceDataListResult<T> {
    private List<LocalDateTime> operationTime;
    private String msg;
    private T data;
    private int code;
    public static <T> DeviceDataListResult<T> success(T t , List<LocalDateTime> operationTime){
        DeviceDataListResult<T> deviceDataListResult = new DeviceDataListResult();
        deviceDataListResult.setCode(200);
        deviceDataListResult.setData(t);
        deviceDataListResult.setMsg("操作成功");
        deviceDataListResult.setOperationTime(operationTime);
        return deviceDataListResult;
    }
    public DeviceDataListResult error(String msg){
        DeviceDataListResult<T> deviceDataListResult = new DeviceDataListResult();
        deviceDataListResult.setCode(500);
        deviceDataListResult.setMsg(msg);
        return deviceDataListResult;
    }
}
